package com.album.activity;

import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
/**
 *  状态机
 *  作者：Rome
 */

import android.R.integer;
import android.graphics.Bitmap;

import com.album.activity.page.PageManager;
import com.album.activity.pageView.UserLoginView;
import com.album.activity.pageView.MyFriendsView;
import com.album.activity.pageView.MyPhotoView;
import com.album.activity.pageView.PicinfoView;
import com.album.activity.pageView.CasualLookView;
import com.album.bean.ImageBean;
import com.album.bean.PicinfoList;
import com.album.bean.RondomUser;
public class SetstateManager {
	/*
	 * 状态机制
	 */
	public static HashMap<Class,PageManager> backtoStateMap = new HashMap<Class,PageManager>();//存放返回的类对象
	public static HashMap<Class,PageManager> refreshMap = new HashMap<Class,PageManager>();//存放刷新界面对象
	public static HashMap<String,List<Integer>> picMap = new HashMap<String,List<Integer>>();//存放图片map
	public static List<Integer> picListTest = new ArrayList<Integer>();
	public static List<String> picList = new ArrayList<String>();//存放单张图片
	public static List<String> picUser = new ArrayList<String>();//存放单张图片
	public static List<String> picListAll = new ArrayList<String>();//存放所有图片
	public static List<PicinfoList> infoList= new ArrayList<PicinfoList>(); //存放随便看看图片bean  只放一个用户
	public static List<HashMap<String, List<String>>> imageIdMapList = new ArrayList<HashMap<String, List<String>>>();//存放用户对应的图片id列表
	public static List<String> usernameList = new ArrayList<String>();
	public static List<List<ImageBean>> imageBeanList = new ArrayList<List<ImageBean>>();
	
	public static final Class UserLoginView= UserLoginView.class;
	public static final Class MainActivity= MainActivity.class;
	public static final Class MyFriendsView = MyFriendsView.class;
	public static final Class MyPhotoView = MyPhotoView.class;
	public static final Class PicinfoView = PicinfoView.class;
	public static final Class CasualLookView = CasualLookView.class;
	public static int type =4;
	public static int public_=0;
	public static int current=1;
	
	public static void setBacktoState(Class c ,PageManager m){
		try {
			if(backtoStateMap != null && !backtoStateMap.isEmpty())
				backtoStateMap.clear();
			if(backtoStateMap != null)
				backtoStateMap.put( c, m);
		} catch (Exception e) {
			e.printStackTrace();
		}
	
	}
	public static void setRefresState(Class c,PageManager m){
		try {
			if(refreshMap != null && !refreshMap.isEmpty())
				refreshMap.clear();
			if(refreshMap != null)
				refreshMap.put( c, m);
		} catch (Exception e) {
			e.printStackTrace();
		}
	
	}
	public static void setPicListState(List<Integer> mImageList){
		try {
			if(picListTest != null && !picListTest.isEmpty())
				picListTest.clear();
			for (int picId : mImageList) {
				picListTest.add(picId);
			}
		} catch (Exception e) {
			e.printStackTrace();
		}
	}
	public static void setPicListState(String picId){
		try {
			if(picList != null && !picList.isEmpty())
				picList.clear();
					picList.add(picId);
		} catch (Exception e) {
			e.printStackTrace();
		}
	}
	public static void setPicUserState(String name){
		try {
			if(picUser != null && !picUser.isEmpty())
				picUser.clear();
			picUser.add(name);
		} catch (Exception e) {
			e.printStackTrace();
		}
	}
	
	
	
	public static void setPicinfoState(PicinfoList piclist){
		try {
			infoList.add(piclist);
		} catch (Exception e) {
			e.printStackTrace();
		}
	}
	
	public static void setPicListAll(String picId){
		try {
			picListAll.add(picId);
		} catch (Exception e) {
			e.printStackTrace();
		}
	}
	
	public static void setPicIdMapState(HashMap<String, List<String>> piclist){
		try {
			imageIdMapList.add(piclist);
		} catch (Exception e) {
			e.printStackTrace();
		}
	}
	public static void setUsernameList(String username){
		try {
			usernameList.add(username);
		} catch (Exception e) {
			e.printStackTrace();
		}
	}
	public static void setPicIdList(List<ImageBean> imageBean){
		try {
			imageBeanList.add(imageBean);
		} catch (Exception e) {
			e.printStackTrace();
		}
	}
	
}
